package org.lzy.shop.adapter

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import org.lzy.shop.R
import org.lzy.shop.response.HomeResponse

class CouponHomeAdapter: BaseQuickAdapter<HomeResponse.CouponDTO, QuickViewHolder>()  {

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): QuickViewHolder {
        return QuickViewHolder(R.layout.item_coupon_list, parent)
    }

    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: HomeResponse.CouponDTO?) {
        item?.let {
            holder.setText(R.id.coupon_title, item.title)
            holder.setText(R.id.endTime, "有效期至: " + item.endTime)
            holder.setText(R.id.amount, "￥ " + item.amount)
            holder.setText(R.id.fullamount, "满 " + item.condition?.fullAmount + "元可用")
        }

    }


}